package org.dromara.house.controller;

import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.house.domain.bo.LeasingTrendsBo;
import org.dromara.house.domain.dto.*;
import org.dromara.house.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 统计
 */
@RestController
@RequestMapping("/park/statistics")
public class StatisticsController extends BaseController {

    @Autowired
    private StatisticsService statisticsService;


    /* *
     * 查询各片区出租率
     *
     */
    @PostMapping("/districtOccupancyRate")
    public R<List<DistrictOccupancyRateDto>> districtOccupancyRate() {
        return statisticsService.districtOccupancyRate();
    }


    /* *
     * 查询各楼宇出租率
     *
     */
    @PostMapping("/housingOccupancyRate")
    public R<List<HousingOccupancyRateDto>> housingOccupancyRate() {
        return statisticsService.housingOccupancyRate();
    }


    /* *
     * 查询租赁趋势
     *
     */
    @PostMapping("/leasingTrends")
    public R<List<LeasingTrendsDto>> leasingTrends(@RequestBody LeasingTrendsBo bo) {
        return statisticsService.leasingTrends(bo);
    }


    /**
     * 总体统计
     *
     * @return
     */
    @PostMapping("/overallStatistics")
    public R<OverallStatisticsDto> overallStatistics() {
        return statisticsService.overallStatistics();
    }

    /**
     * 片区统计
     *
     * @return
     */
    @PostMapping("/districtStatistics")
    public R<DistrictStatisticsDto> districtStatistics(@RequestBody LeasingTrendsBo bo) {
        return statisticsService.districtStatistics(bo);
    }


    /**
     * 楼宇统计
     *
     * @return
     */
    @PostMapping("/housingStatistics")
    public R<HousingStatisticsDto> housingStatistics(@RequestBody LeasingTrendsBo bo) {
        return statisticsService.housingStatistics(bo);
    }

    /**
     * 获取房源表列表
     */
    @GetMapping("/housingList")
    public TableDataInfo<ParkHousingDto> list(LeasingTrendsBo bo, PageQuery pageQuery) {
        return statisticsService.selectPageList(bo, pageQuery);
    }


}
